import fake_useragent
import os



#
# myql_params = {
#         "host": "rm-rj9x18l81qag19gkvao.mysql.rds.aliyuncs.com",
#         "port": 1888,
#         "database": "nlp",
#         "user": "wangtaolp",
#         "password": "wangtao@123lp654"
#
#         }
import pymysql

myql_params = {
         "host": "dev-lp888.mysql.rds.aliyuncs.com",
         "port": 1888,
         "db": "nlp",
         "user": "nlp",
         "password": "LPdate@nlp",
         "cursorclass": pymysql.cursors.DictCursor
         }

# webhook_url="https://oapi.dingtalk.com/robot/send?access_token=6c4fb9dd5ab74c087fa25abcbd201906bbda5a146a92d947011415140467bbcd"
webhook_url="https://oapi.dingtalk.com/robot/send?access_token=25a9dee4635678f1b81bd77697c0e215ad4aac8c43407425dab0ac73eeef814a"

# myql_params = {
#             "host": "dev-lp888.mysql.rds.aliyuncs.com",
#             "port": 1888,
#             "database": "nlp",
#             "user": "inlp",
#             "password": "nlp123@longpean"
#         }

redis_conf = {
        "host": "r-bp1e8lecdfhttng2pbpd.redis.rds.aliyuncs.com",
        "port": 6999,
        "db": 6,
        "password": "redis123@"
    }

USER_AGENTS = ['Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11',
 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.71 Safari/537.1 LBBROWSER',
 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; LBBROWSER) ',
 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E; LBBROWSER)" ',
 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.84 Safari/535.11 LBBROWSER',
 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) ',
 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; QQBrowser/7.0.3698.400) ',
 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E) ',
 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SV1; QQDownload 732; .NET4.0C; .NET4.0E; 360SE) ',
 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E) ',
 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) ',
 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1',
 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1',
 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E) ',
 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) ',
 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) ',
 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.84 Safari/535.11 SE 2.X MetaSr 1.0',
 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SV1; QQDownload 732; .NET4.0C; .NET4.0E; SE 2.X MetaSr 1.0) ',
 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:16.0) Gecko/20121026 Firefox/16.0',
 'Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5',
 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b13pre) Gecko/20110307 Firefox/4.0b13pre',
 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0',
 'Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15',
 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.133 Safari/534.16',
 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)',
 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)',
 'Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10',
 ]


def get_header():
 location = os.getcwd() + '/fake_useragent.json'
 ua = fake_useragent.UserAgent(path=location)
 return ua.random


# key_words = [
# 'ppecentral       '
# ,'tvshoppingnow    '
# ,'smartfit101      '
# ,'kitchenaide      '
# ,'kitchen-plus     '
# ,'partnergadgets   '
# ,'save-way         '
# ,'fit-collection   '
# ,'onedaytool       '
# ,'101workshop      '
# ,'my-fit           '
# ,'besttelescopes   '
# ,'hot-gadgets      '
# ,'gadgetlol        '
# ,'smartgoods       '
# ,'goodgadgets      '
# ,'buygadgets       '
# ,'buy-widgets      '
# ,'bestfitstores    '
# ,'buyteclescopes   '
# ,'trybestproducts  '
# ,'buysupergadgets  '
# ,'sellgadgetstool  '
# ,'find-gadgets     '
# ,'topelectrictool  '
# ,'electric-tools   '
# ,'buypowerfit      '
# ,'powerlegs        '
# ,'rotorazer        '
# ,'powerlegusa      '
# ,'nama-juicer      '
# ,'buypowerleg      '
# ,'vibration-platfor'
# ,'buyelectrictool  '
# ,'yoga-exercises   '
# ,'kitchenelectricpr'
# ,'buyrotorazersaw  '
# ,'cubiiexercise    '
# ,'theelectrictool  '
# ,'kitchen-electric '
# ,'cubii-exercise   '
# ,'items-way        '
# ,'gadgetsoutlets   '
# ,'venusgadgets     '
# ,'trybestproducts  '
# ,'bestelectrictool '
#     ,
#
#     "AW-","UA-","GTM-","google-site-verification",'items-way','gadgetsoutlets','geniuswidgets','ppecentral','ppe central', 'ppe_central', 'ppe-central', 'items way', 'items_way', 'items-way', 'tv shopping now', 'tv_shopping_now', 'tv-shopping-now', 'gadgets outlets', 'gadgets_outlets', 'gadgets-outlets', 'kitchen aide', 'kitchen_aide', 'kitchen-aide', 'fit collection', 'fit_collection', 'fit-collection', '101 work shop', '101_work_shop', '101-work-shop', 'buy widgets', 'buy_widgets', 'buy-widgets', 'smart goods', 'smart_goods', 'smart-goods', 'buy teclescopes', 'buy_teclescopes', 'buy-teclescopes', 'electric tools', 'electric_tools', 'electric-tools', 'hot gadgets', 'hot_gadgets', 'hot-gadgets', 'buy gadgets', 'buy_gadgets', 'buy-gadgets', 'Best gadgets tool', 'Best_gadgets_tool', 'Best-gadgets-tool', 'buy super gadgets', 'buy_super_gadgets', 'buy-super-gadgets', 'sell gadgets tool', 'sell_gadgets_tool', 'sell-gadgets-tool', 'find gadgets', 'find_gadgets', 'find-gadgets', 'gadget lol', 'gadget_lol', 'gadget-lol', 'best telescopes', 'best_telescopes', 'best-telescopes', 'best Fit stores', 'best_Fit_stores', 'best-Fit-stores', 'try best products', 'try_best_products', 'try-best-products', 'best telescopes', 'best_telescopes', 'best-telescopes', 'best Fit stores', 'best_Fit_stores', 'best-Fit-stores', 'try best products', 'try_best_products', 'try-best-products']


#key_words =['rotarazer','candymoono','longpean','buyteclescopes', 'buy_gadgets', 'hot gadgets', 'buyrotorazersaw', 'bestelectrictool', 'gadgetlol', 'fit_collection', 'sell_gadgets_tool', 'vibration-platfor', 'kitchenaide', 'yoga-exercises', 'buy super gadgets', 'smart goods', 'sell-gadgets-tool', 'UA-', 'smartfit101', 'trybestproducts', 'GTM-', '101-work-shop', 'buy-teclescopes', 'hot_gadgets', 'fit-collection', 'buy teclescopes', 'try_best_products', 'buysupergadgets', 'buygadgets', 'kitchen aide', '101_work_shop', 'buy-super-gadgets', 'try best products', 'gadgetsoutlets', 'try-best-products', 'cubiiexercise', 'partnergadgets', 'smart_goods', 'my-fit', 'best_telescopes', '101 work shop', 'buypowerleg', 'electric-tools', 'smartgoods', 'best_Fit_stores', 'buy gadgets', 'Best gadgets tool', 'find_gadgets', 'kitchen-aide', 'buy-widgets', 'sellgadgetstool', 'besttelescopes', 'items_way', 'ppe-central', 'rotorazer', 'gadgets outlets', 'AW-', 'geniuswidgets', 'google-site-verification', 'powerlegs', 'cubii-exercise', 'electric tools', 'gadgets_outlets', 'electric_tools', 'buy_super_gadgets', 'fit collection', 'kitchen-electric', 'venusgadgets', 'buy-gadgets', 'ppecentral', 'best Fit stores', 'kitchen_aide', 'Best_gadgets_tool', 'kitchenelectricpr', 'powerlegusa', 'topelectrictool', 'tv_shopping_now', 'items-way', 'find-gadgets', 'find gadgets', '101workshop', 'kitchen-plus', 'goodgadgets', 'best-telescopes', 'bestfitstores', 'items way', 'tv shopping now', 'best-Fit-stores', 'save-way', 'tvshoppingnow', 'tv-shopping-now', 'smart-goods', 'gadget-lol', 'gadget lol', 'buypowerfit', 'ppe_central', 'buy_widgets', 'ppe central', 'Best-gadgets-tool', 'onedaytool', 'theelectrictool', 'gadgets-outlets', 'nama-juicer', 'gadget_lol', 'sell gadgets tool', 'hot-gadgets', 'buy_teclescopes', 'best telescopes', 'buyelectrictool', 'buy widgets']

key_words=[
    'rotarazer','candymoono','longpean','buyteclescopes','buy_gadgets','hot gadgets','buyrotorazersaw','bestelectrictool','gadgetlol',
    'fit_collection','sell_gadgets_tool','vibration-platfor','kitchenaide','yoga-exercises','buy super gadgets','smart goods','sell-gadgets-tool',
    'UA-','smartfit101','trybestproducts','GTM-','101-work-shop','buy-teclescopes','hot_gadgets','fit-collection','buy teclescopes',
    'try_best_products','buysupergadgets','buygadgets','kitchen aide','101_work_shop','buy-super-gadgets','try best products','gadgetsoutlets',
    'try-best-products','cubiiexercise','partnergadgets','smart_goods','my-fit','best_telescopes','101 work shop','buypowerleg','electric-tools',
    'smartgoods','best_Fit_stores','buy gadgets','Best gadgets tool','find_gadgets','kitchen-aide','buy-widgets','sellgadgetstool',
    'besttelescopes','items_way','ppe-central','rotorazer','gadgets outlets','AW-','geniuswidgets','google-site-verification','powerlegs',
    'cubii-exercise','electric tools','gadgets_outlets','electric_tools','buy_super_gadgets','fit collection','kitchen-electric','venusgadgets',
    'buy-gadgets','ppecentral','best Fit stores','kitchen_aide','Best_gadgets_tool','kitchenelectricpr','powerlegusa','topelectrictool',
    'tv_shopping_now','items-way','find-gadgets','find gadgets','101workshop','kitchen-plus','goodgadgets','best-telescopes','bestfitstores',
    'items way','tv shopping now','best-Fit-stores','save-way','tvshoppingnow','tv-shopping-now','smart-goods','gadget-lol','gadget lol',
    'buypowerfit','ppe_central','buy_widgets','ppe central','Best-gadgets-tool','onedaytool','theelectrictool','gadgets-outlets','nama-juicer',
    'gadget_lol','sell gadgets tool','hot-gadgets','buy_teclescopes','best telescopes','buyelectrictool','buy widgets','gizmoscentral',
    'gizmo-express','gizmo express','gizmo_express','vogue-buy','vogue buy','vogue_buy','ifloralart','gotham-hammered','gotham hammered',
    'gotham_hammered','uslyfe','shopustores','commandobro','today-fitness','today fitness','today_fitness','hotkitchenfold','shop-fun',
    'shop fun','shop_fun','electric-home','electric home','electric_home','widgets-kitchen','widgets kitchen','widgets_kitchen','golovebuy',
    'yourpowertool','my-fit','my fit','my_fit','smartfit101','buyteclescopes','trybodygadget','RotorazerBigSale','achirpwheel','homekitchentool',
    'homepowertool','buy-saw','buy saw','buy_saw','goodgadgets','buypowerleg','happyshops','now-shopping','now shopping','now_shopping',
    'shopusaclub','rotorazer','rotorrazor','rotozip','razor','PSO-RITE','PSO RITE','PSO RITE','PowerXL','Power XL','H2O X5','h2o mop','x5mop',
    'h2o mop x5','Gotham Steel Hammered','Gotham Steel','chirp','plexus','ifloralart','tryhomegym','trybodygadget','home-techgadgets',
    'hometechgadgets','home_techgadgets','achirpwheel','smart-kitchen','smartkitchen','smart_kitchen','fab-gizmos','fabgizmos',
    'fab_gizmos','100gizmoscom','cubiielliptical','hometechwidgets','get-homegarden','gethomegarden','get_homegarden','hot-fitstores',
    'hotfitstores','hot_fitstores','home-gardens', 'homegardens','home_gardens','powerlegsmassager','smart-gadgets','smartgadgets','smart_gadgets',
    'vibration-machine','vibrationmachine','vibration_machine','home-techgadgets','hometechgadgets','home_techgadgets','bestpowerfitness',
    'getpowerleg','coldpressjuicer','homedecoration','homeswidget','rotorazerbigsale','buyfootmassagers','hotkitchenfold','gotham-hammered',
    'gothamhammered','gotham_hammered','body-gadget','bodygadget','body_gadget','slow-juicer','slowjuicer','slow_juicer','kitchen-support',
    'kitchensupport','kitchen_support','home-gym','homegym','home_gym','smart-kitchen','smartkitchen','smart_kitchen','gadgets-pie',
    'gadgetspie','gadgets_pie','tech-gadgetst','techgadgets','techgadgets','Buycomfortpillow','Buycomfortpillow',
    'powerfit','cubii','nama','Vibro','H2OX5','FlexTech','POWERLEG','powerleg','longpean','Candymoono', 'Candy moono', 'Candy-moono',
    'Lp.candymoon', 'Lp candy moon ', 'Lp-candy-moon', 'Sereincrush', 'Serein crush', 'Serein-crush', 'Dollromeo', 'Doll romeo',
    'Doll-romeo', 'Elleclothes ', 'Elle clothes ', 'Elle-clothes', 'Waclothes  ', 'Wa clothes', 'Wa-clothes', 'Commandobro',
    'Commando bro', 'Commando-bro', 'Hyggebag ', 'Hygge bag', 'Hygge-bag', 'Venezialeather', 'Venezia leather', 'Venezia-leather',
    'birddogs','bird dog'
]



taoken =['s2_csrf_cookie_name=5337cd39a3c9d7ffc45c5968f5ca0f1b; _ga=GA1.2.396103770.1596769421; _gid=GA1.2.160506532.1596769421; __gads=ID=64a1f1aeaaf5b757:T=1596769422:S=ALNI_MaZOE2TprpuxyzT2TzdzilDvYFjDg; sw=93.5; sh=92; PHPSESSID=b8n22akv58csbipjbhrrpcn8p7; s2_uGoo=93ebdac84a0eba4950ffec5f597f43c8a19d95b7; _gat=1; __unam=737437c-173c6dfc7eb-646f9b6c-4; s2_csrf_cookie_name=5337cd39a3c9d7ffc45c5968f5ca0f1b',
         's2_csrf_cookie_name=b3a31039d9d4d3f26ba939dd307ac540; PHPSESSID=o726086v8gqlk8ec0ekfnuril2; _ga=GA1.2.1009318353.1596770462; _gid=GA1.2.1743031367.1596770462; s2_uGoo=7354ad3e8e1bdd61f6d2a5878801ddba56fdfb65; s2_csrf_cookie_name=b3a31039d9d4d3f26ba939dd307ac540; s2_uLang=en; s2_theme_ui=red; __unam=737437c-173c6e5bc4b-56e9cc0a-4; sw=64.6; sh=95.2',
         ]
